﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using WpfSendKeys;

namespace WPFSendKey.Examples
{
    /// <summary>
    /// Example3.xaml 的交互逻辑
    /// </summary>
    public partial class Example3 : Window
    {
        public Example3()
        {
            InitializeComponent();
            Loaded += MainWindow_Loaded;
        }


        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {

           textbox1.Focus();
           SimulateKeyboard.Type("notepad");
           SimulateKeyboard.Press(Key.Enter);
            //SimulateKeyboard.Release(Key.Enter);

            //SimulateKeyboard.Press(Key.LeftAlt);
            //SimulateKeyboard.Press(Key.F4);
            //SimulateKeyboard.Release(Key.LeftAlt);
            //SimulateKeyboard.Release(Key.F4);
          
         
        }

        private void OK_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void SimulateButton_Click(object sender, RoutedEventArgs e)
        {
            Window window = Window.GetWindow(OKButton);
            Point point = OKButton.TransformToAncestor(window).Transform(new Point(0, 0));
            SimulateMouse.MoveTo(new System.Drawing.Point(435, 275));
            SimulateMouse.Click(MouseButton.Left);
            Point points = Mouse.GetPosition(this);
            string str = "";
        }

    }
}
